package com.onenine.app.adapter;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.mcxtzhang.swipemenulib.SwipeMenuLayout;
import com.onenine.app.R;
import com.onenine.app.model.MemberItem;
import com.onenine.app.utils.GlideUtils;

public class FriendListAdapter extends BaseQuickAdapter<MemberItem, BaseViewHolder> {

    private int mType;

    public FriendListAdapter(int type) {
        super(R.layout.layout_friend_attention_item);
        mType = type;
    }

    @Override
    protected void convert(final BaseViewHolder viewHolder, final MemberItem item) {
        SwipeMenuLayout swipeMenuLayout = viewHolder.getView(R.id.sml_view);
        swipeMenuLayout.setSwipeEnable(mType == 0);
        GlideUtils.loadCircleAvatar(viewHolder.getConvertView()
                , viewHolder.getView(R.id.iv_avatar), item.getPhoto());
        viewHolder.setText(R.id.tv_name, item.getNickName());
        viewHolder.addOnClickListener(R.id.rl_view).addOnClickListener(R.id.btn_delete);
    }

}
